import 'package:flutter/material.dart';

import 'common/global.dart';

extension ListExt on List<int> {
  ///二进制转hex
  String toHexString({bool upperCase = false}) {
    var rs = this.map((b) => '${b.toRadixString(16).padLeft(2, '0')}').join();
    if (upperCase) {
      rs = rs.toUpperCase();
    }
    return rs;
  }
}

extension BoolExt on bool {
  ///bool转int表示
  int toInt() {
    return this ? 1 : 0;
  }
}

/// 是否小屏手机
bool kIsSmallPhone(BuildContext context) {
  return MediaQuery.of(context).size.width <= 667;
}

//log
void logd(dynamic message) {
  logger.d(message);
}

void logi(dynamic message) {
  logger.i(message);
}
